<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>视频面试 - 招聘APP</title>
    <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            background-color: #000;
            height: 100vh;
            margin: 0;
            overflow: hidden;
        }
        .app-container {
            max-width: 390px;
            height: 100%;
            margin: 0 auto;
            background-color: #000;
            position: relative;
            overflow: hidden;
        }
        .video-container {
            width: 100%;
            height: 100%;
            position: relative;
        }
        .remote-video {
            width: 100%;
            height: 100%;
            object-fit: cover;
            position: absolute;
            top: 0;
            left: 0;
        }
        .local-video {
            position: absolute;
            top: 20px;
            right: 20px;
            width: 110px;
            height: 160px;
            border-radius: 12px;
            overflow: hidden;
            border: 2px solid white;
            z-index: 10;
        }
        .local-video img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .controls {
            position: absolute;
            bottom: 40px;
            left: 0;
            right: 0;
            display: flex;
            justify-content: center;
            gap: 20px;
            z-index: 10;
        }
        .control-btn {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background-color: rgba(255, 255, 255, 0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            cursor: pointer;
            transition: all 0.3s;
        }
        .control-btn:hover {
            background-color: rgba(255, 255, 255, 0.3);
        }
        .control-btn.mute.active {
            background-color: #ff4d4f;
        }
        .control-btn.video-off.active {
            background-color: #ff4d4f;
        }
        .control-btn.end-call {
            background-color: #ff4d4f;
        }
        .control-btn.end-call:hover {
            background-color: #ff7875;
        }
        .call-info {
            position: absolute;
            top: 20px;
            left: 20px;
            color: white;
            z-index: 10;
        }
        .call-name {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 5px;
            display: flex;
            align-items: center;
        }
        .call-name i {
            margin-right: 8px;
        }
        .call-timer {
            font-size: 14px;
            opacity: 0.8;
        }
        .call-status {
            position: absolute;
            top: 50%;
            left: 0;
            right: 0;
            transform: translateY(-50%);
            text-align: center;
            color: white;
            font-size: 20px;
            font-weight: 600;
            z-index: 5;
        }
        .call-status.connecting {
            animation: blink 1.5s infinite;
        }
        @keyframes blink {
            0% { opacity: 0.4; }
            50% { opacity: 1; }
            100% { opacity: 0.4; }
        }
        .overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.5);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 20;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.3s, visibility 0.3s;
        }
        .overlay.active {
            opacity: 1;
            visibility: visible;
        }
        .feedback-container {
            width: 90%;
            max-width: 350px;
            background-color: white;
            border-radius: 12px;
            overflow: hidden;
        }
        .feedback-header {
            padding: 15px;
            border-bottom: 1px solid #eee;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .feedback-title {
            font-weight: 600;
            font-size: 18px;
        }
        .feedback-close {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: #f5f5f5;
            cursor: pointer;
        }
        .feedback-body {
            padding: 15px;
        }
        .feedback-form {
            display: flex;
            flex-direction: column;
            gap: 15px;
        }
        .rating {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        .rating-title {
            font-weight: 500;
            font-size: 16px;
        }
        .stars {
            display: flex;
            gap: 8px;
        }
        .star {
            font-size: 24px;
            color: #d9d9d9;
            cursor: pointer;
        }
        .star.active {
            color: #fadb14;
        }
        .feedback-textarea {
            width: 100%;
            padding: 10px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            height: 100px;
            resize: none;
            font-size: 14px;
        }
        .feedback-textarea:focus {
            border-color: #1677ff;
            outline: none;
            box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1);
        }
        .feedback-footer {
            padding: 15px;
            border-top: 1px solid #eee;
            display: flex;
            justify-content: flex-end;
            gap: 10px;
        }
        .feedback-btn {
            padding: 8px 15px;
            border-radius: 4px;
            font-size: 14px;
            cursor: pointer;
        }
        .feedback-btn.cancel {
            background-color: #f5f5f5;
            color: #666;
        }
        .feedback-btn.submit {
            background-color: #1677ff;
            color: white;
        }
        .interview-questions {
            position: absolute;
            bottom: 110px;
            left: 20px;
            right: 20px;
            background-color: rgba(0, 0, 0, 0.6);
            border-radius: 12px;
            padding: 15px;
            color: white;
            z-index: 10;
            max-height: 200px;
            overflow-y: auto;
        }
        .questions-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
        }
        .questions-title {
            font-weight: 600;
            font-size: 16px;
        }
        .questions-toggle {
            font-size: 12px;
            color: #1677ff;
            cursor: pointer;
        }
        .question-item {
            margin-bottom: 10px;
            font-size: 14px;
            line-height: 1.5;
        }
        .question-item:last-child {
            margin-bottom: 0;
        }
        .chat-btn {
            position: absolute;
            bottom: 110px;
            right: 20px;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background-color: rgba(255, 255, 255, 0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            cursor: pointer;
            z-index: 10;
        }
        .chat-btn.active {
            background-color: #1677ff;
        }
        .chat-container {
            position: absolute;
            bottom: 110px;
            left: 20px;
            right: 20px;
            background-color: rgba(0, 0, 0, 0.6);
            border-radius: 12px;
            padding: 15px;
            color: white;
            z-index: 10;
            height: 200px;
            display: flex;
            flex-direction: column;
            display: none;
        }
        .chat-messages {
            flex: 1;
            overflow-y: auto;
            margin-bottom: 10px;
        }
        .chat-input-container {
            display: flex;
            gap: 10px;
        }
        .chat-input {
            flex: 1;
            padding: 8px 12px;
            border-radius: 20px;
            border: none;
            background-color: rgba(255, 255, 255, 0.2);
            color: white;
            font-size: 14px;
        }
        .chat-input::placeholder {
            color: rgba(255, 255, 255, 0.5);
        }
        .chat-send {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background-color: #1677ff;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            cursor: pointer;
        }
        .message {
            margin-bottom: 8px;
            font-size: 14px;
        }
        .message-sender {
            font-weight: 500;
            margin-right: 5px;
            color: #1677ff;
        }
        .message-content {
            color: white;
        }
    </style>
</head>
<body>
    <div class="app-container">
        <div class="video-container">
            <!-- 远程视频 -->
            <img src="https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTB8fHByb2ZpbGV8ZW58MHx8MHx8&auto=format&fit=crop&w=500&h=800&q=80" alt="远程视频" class="remote-video">
            
            <!-- 本地视频 -->
            <div class="local-video">
                <img src="https://images.unsplash.com/photo-1486406146926-c627a92ad1ab?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8Y29tcGFueXxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=200&h=300&q=80" alt="本地视频">
            </div>
            
            <!-- 通话信息 -->
            <div class="call-info">
                <div class="call-name">
                    <i class="fas fa-user-circle"></i>
                    <span>张伟 (前端开发工程师)</span>
                </div>
                <div class="call-timer" id="call-timer">00:15:32</div>
            </div>
            
            <!-- 通话状态 -->
            <div class="call-status connecting" id="call-status">正在连接...</div>
            
            <!-- 面试问题 -->
            <div class="interview-questions" id="interview-questions">
                <div class="questions-header">
                    <div class="questions-title">面试问题</div>
                    <div class="questions-toggle" id="questions-toggle">收起</div>
                </div>
                <div class="question-item">1. 请介绍一下你在前端开发方面的经验和技能？</div>
                <div class="question-item">2. 你是如何处理前端性能优化的？能否分享一个具体的例子？</div>
                <div class="question-item">3. 在你参与过的项目中，遇到过哪些技术挑战？你是如何解决的？</div>
                <div class="question-item">4. 你对微前端架构有什么了解？在实际项目中如何应用？</div>
                <div class="question-item">5. 你如何看待前端技术的发展趋势？未来你想在哪些方面提升自己？</div>
            </div>
            
            <!-- 聊天按钮 -->
            <div class="chat-btn" id="chat-btn">
                <i class="fas fa-comment"></i>
            </div>
            
            <!-- 聊天容器 -->
            <div class="chat-container" id="chat-container">
                <div class="chat-messages" id="chat-messages">
                    <div class="message">
                        <span class="message-sender">系统:</span>
                        <span class="message-content">视频面试已开始，您可以在这里发送消息</span>
                    </div>
                    <div class="message">
                        <span class="message-sender">科技智联:</span>
                        <span class="message-content">您好，张伟，很高兴见到您！</span>
                    </div>
                    <div class="message">
                        <span class="message-sender">张伟:</span>
                        <span class="message-content">您好，我也很高兴能有这次面试机会</span>
                    </div>
                </div>
                <div class="chat-input-container">
                    <input type="text" class="chat-input" placeholder="输入消息..." id="chat-input">
                    <div class="chat-send" id="chat-send">
                        <i class="fas fa-paper-plane"></i>
                    </div>
                </div>
            </div>
            
            <!-- 控制按钮 -->
            <div class="controls">
                <div class="control-btn mute" id="mute-btn">
                    <i class="fas fa-microphone"></i>
                </div>
                <div class="control-btn video-off" id="video-btn">
                    <i class="fas fa-video"></i>
                </div>
                <div class="control-btn end-call" id="end-call-btn">
                    <i class="fas fa-phone-slash"></i>
                </div>
            </div>
        </div>
        
        <!-- 面试评价弹窗 -->
        <div class="overlay" id="feedback-overlay">
            <div class="feedback-container">
                <div class="feedback-header">
                    <div class="feedback-title">面试评价</div>
                    <div class="feedback-close" id="feedback-close">
                        <i class="fas fa-times"></i>
                    </div>
                </div>
                <div class="feedback-body">
                    <div class="feedback-form">
                        <div class="rating">
                            <div class="rating-title">专业能力</div>
                            <div class="stars" id="skill-stars">
                                <i class="fas fa-star star" data-value="1"></i>
                                <i class="fas fa-star star" data-value="2"></i>
                                <i class="fas fa-star star" data-value="3"></i>
                                <i class="fas fa-star star" data-value="4"></i>
                                <i class="fas fa-star star" data-value="5"></i>
                            </div>
                        </div>
                        <div class="rating">
                            <div class="rating-title">沟通能力</div>
                            <div class="stars" id="communication-stars">
                                <i class="fas fa-star star" data-value="1"></i>
                                <i class="fas fa-star star" data-value="2"></i>
                                <i class="fas fa-star star" data-value="3"></i>
                                <i class="fas fa-star star" data-value="4"></i>
                                <i class="fas fa-star star" data-value="5"></i>
                            </div>
                        </div>
                        <div class="rating">
                            <div class="rating-title">团队协作</div>
                            <div class="stars" id="teamwork-stars">
                                <i class="fas fa-star star" data-value="1"></i>
                                <i class="fas fa-star star" data-value="2"></i>
                                <i class="fas fa-star star" data-value="3"></i>
                                <i class="fas fa-star star" data-value="4"></i>
                                <i class="fas fa-star star" data-value="5"></i>
                            </div>
                        </div>
                        <div>
                            <textarea class="feedback-textarea" placeholder="请输入面试评价和反馈..."></textarea>
                        </div>
                    </div>
                </div>
                <div class="feedback-footer">
                    <button class="feedback-btn cancel" id="feedback-cancel">取消</button>
                    <button class="feedback-btn submit" id="feedback-submit">提交</button>
                </div>
            </div>
        </div>
    </div>

    <script>
        // 模拟通话连接
        const callStatus = document.getElementById('call-status');
        setTimeout(() => {
            callStatus.textContent = '通话已接通';
            callStatus.classList.remove('connecting');
            
            // 3秒后隐藏状态提示
            setTimeout(() => {
                callStatus.style.display = 'none';
            }, 3000);
        }, 2000);
        
        // 计时器
        const callTimer = document.getElementById('call-timer');
        let seconds = 932; // 15:32
        setInterval(() => {
            seconds++;
            const minutes = Math.floor(seconds / 60);
            const remainingSeconds = seconds % 60;
            callTimer.textContent = `${String(minutes).padStart(2, '0')}:${String(remainingSeconds).padStart(2, '0')}`;
        }, 1000);
        
        // 控制按钮
        const muteBtn = document.getElementById('mute-btn');
        const videoBtn = document.getElementById('video-btn');
        const endCallBtn = document.getElementById('end-call-btn');
        const feedbackOverlay = document.getElementById('feedback-overlay');
        const feedbackClose = document.getElementById('feedback-close');
        const feedbackCancel = document.getElementById('feedback-cancel');
        const feedbackSubmit = document.getElementById('feedback-submit');
        
        muteBtn.addEventListener('click', () => {
            muteBtn.classList.toggle('active');
            if (muteBtn.classList.contains('active')) {
                muteBtn.innerHTML = '<i class="fas fa-microphone-slash"></i>';
            } else {
                muteBtn.innerHTML = '<i class="fas fa-microphone"></i>';
            }
        });
        
        videoBtn.addEventListener('click', () => {
            videoBtn.classList.toggle('active');
            if (videoBtn.classList.contains('active')) {
                videoBtn.innerHTML = '<i class="fas fa-video-slash"></i>';
            } else {
                videoBtn.innerHTML = '<i class="fas fa-video"></i>';
            }
        });
        
        // 结束通话 -> 打开评价弹窗
        endCallBtn.addEventListener('click', () => {
            feedbackOverlay.classList.add('active');
        });
        
        feedbackClose.addEventListener('click', () => {
            feedbackOverlay.classList.remove('active');
        });
        
        feedbackCancel.addEventListener('click', () => {
            feedbackOverlay.classList.remove('active');
        });
        
        // 提交评价 -> 生成报告并返回聊天
        feedbackSubmit.addEventListener('click', () => {
            const starsToScore = (containerId) => {
                const active = document.querySelectorAll(`#${containerId} .star.active`).length;
                return active; // 1-5
            };
            const score = Math.round((starsToScore('skill-stars') + starsToScore('communication-stars') + starsToScore('teamwork-stars')) / 3 * 20); // 转百分制
            const report = {
                candidate: '张伟',
                position: '前端开发工程师',
                score,
                highlights: '沟通清晰，React/TS 实战经验丰富',
                createdAt: Date.now()
            };
            const record = {
                durationSec: seconds,
                endedAt: Date.now()
            };
            localStorage.setItem('lastInterviewReport', JSON.stringify(report));
            localStorage.setItem('lastInterviewRecord', JSON.stringify(record));
            alert('评价已提交，面试报告已生成');
            window.location.href = 'chat.html';
        });
        
        // 星级评分
        const starContainers = document.querySelectorAll('.stars');
        starContainers.forEach(container => {
            const stars = container.querySelectorAll('.star');
            stars.forEach(star => {
                star.addEventListener('click', () => {
                    const value = parseInt(star.getAttribute('data-value'));
                    stars.forEach(s => {
                        const starValue = parseInt(s.getAttribute('data-value'));
                        if (starValue <= value) {
                            s.classList.add('active');
                        } else {
                            s.classList.remove('active');
                        }
                    });
                });
            });
        });
        
        // 面试问题
        const questionsToggle = document.getElementById('questions-toggle');
        const interviewQuestions = document.getElementById('interview-questions');
        
        questionsToggle.addEventListener('click', () => {
            if (questionsToggle.textContent === '收起') {
                interviewQuestions.style.height = '40px';
                interviewQuestions.style.overflow = 'hidden';
                questionsToggle.textContent = '展开';
            } else {
                interviewQuestions.style.height = 'auto';
                interviewQuestions.style.maxHeight = '200px';
                interviewQuestions.style.overflow = 'auto';
                questionsToggle.textContent = '收起';
            }
        });
        
        // 聊天功能
        const chatBtn = document.getElementById('chat-btn');
        const chatContainer = document.getElementById('chat-container');
        const chatInput = document.getElementById('chat-input');
        const chatSend = document.getElementById('chat-send');
        const chatMessages = document.getElementById('chat-messages');
        
        chatBtn.addEventListener('click', () => {
            chatBtn.classList.toggle('active');
            if (chatBtn.classList.contains('active')) {
                chatContainer.style.display = 'flex';
                interviewQuestions.style.display = 'none';
            } else {
                chatContainer.style.display = 'none';
                interviewQuestions.style.display = 'block';
            }
        });
        
        chatSend.addEventListener('click', sendMessage);
        chatInput.addEventListener('keypress', (e) => {
            if (e.key === 'Enter') {
                sendMessage();
            }
        });
        
        function sendMessage() {
            const message = chatInput.value.trim();
            if (message) {
                const messageHTML = `
                    <div class="message">
                        <span class="message-sender">科技智联:</span>
                        <span class="message-content">${message}</span>
                    </div>
                `;
                chatMessages.insertAdjacentHTML('beforeend', messageHTML);
                chatInput.value = '';
                chatMessages.scrollTop = chatMessages.scrollHeight;
                
                // 模拟回复
                setTimeout(() => {
                    const replies = [
                        "好的，我明白了",
                        "这个问题我需要思考一下",
                        "是的，我有相关的项目经验",
                        "我认为这是一个很好的解决方案",
                        "我可以分享一下我的想法吗？"
                    ];
                    const randomReply = replies[Math.floor(Math.random() * replies.length)];
                    const replyHTML = `
                        <div class="message">
                            <span class="message-sender">张伟:</span>
                            <span class="message-content">${randomReply}</span>
                        </div>
                    `;
                    chatMessages.insertAdjacentHTML('beforeend', replyHTML);
                    chatMessages.scrollTop = chatMessages.scrollHeight;
                }, 1500);
            }
        }
    </script>
</body>
</html> 